//
//  UIScrollView+MMRefresh.h
//  MMSDK
//
//  Created by 君若见故 on 16/4/27.
//  Copyright © 2016年 isoftstone. All rights reserved.
//

#import <UIKit/UIKit.h>
/**
    刷新状态
 */
typedef enum : NSUInteger {
    //普通闲置状态
    MMRefreshStateIdle = 1,
    //松开就可以进行刷新的状态
    MMRefreshStatePulling,
    //正在刷新中的状态
    MMRefreshStateRefreshing,
} MMRefreshState;

/**
    header,AutoFooter,BackFooter
 */
typedef enum : NSUInteger {

    MMRefreshPartHeader = 1,
    MMRefreshPartAutoFooter,
    MMRefreshPartBackFooter,
} MMRefreshPart;

//刷新回调
typedef void(^refreshBlock)(void);

@interface UIScrollView (MMRefresh)
#pragma mark - headerRefresh
/**
 *  创建普通的header,block
 *
 *  @param block 刷新回调
 */
- (void)addNormalHeaderRefreshWithBlock:(refreshBlock)block;
/**
 *  创建普通的header,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addNormalHeaderRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  创建动画header,block
 *
 *  @param block 刷新回调
 */
- (void)addGifHeaderRefreshWithBlock:(refreshBlock)block;
/**
 *  创建动画header,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addGifHeaderRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  是否显示时间标签
 *
 *  param flag bool
 */
- (void)isShowTimeLabel:(BOOL)flag;
/**
 *  是否显示标题标签
 *
 *  param flag bool
 */
- (void)isShowStateLabel:(BOOL)flag;

#pragma mark- footerRefresh
/**
 *  创建普通的footer,block
 *
 *  @param block 刷新回调
 */
- (void)addAutoNormalFooterRefreshWithBlock:(refreshBlock)block;
/**
 *  创建普通的footer,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addAutoNormalFooterRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  创建动画footer,block
 *
 *  @param block 刷新回调
 */
- (void)addAutoGifFooterRefreshWithBlock:(refreshBlock)block;
/**
 *  创建动画footer,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addAutoGifFooterRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  创建自动回弹的footer,block
 *
 *  @param block 刷新回调
 */
- (void)addBackNormalFooterRefreshWithBlock:(refreshBlock)block;
/**
 *  创建自动回弹的block,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addBackNormalFooterRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  创建自动回弹动画的block,block
 *
 *  @param block 刷新回调
 */
- (void)addBackGifFooterRefreshWithBlock:(refreshBlock)block;
/**
 *  创建自动回弹动画的block,target
 *
 *  @param obj      目标
 *  @param selector 方法
 */
- (void)addBackGifFooterRefreshWithTarget:(id)obj action:(SEL)selector;
/**
 *  是否显示footer标题
 *  @part MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 *  param flag bool
 */

//删除上拉加载
- (void)removeFooterRefresh;

- (void)isPart:(MMRefreshPart)part ShowTitleLabel:(BOOL)flag;
/**
 *  没有更多数据
 */
- (void)setNoMoreData;
/**
 *  重置没有更多数据状态
 */
- (void)resetNoMoreData;
#pragma mark- Common

/**
 *  创建动画，在动画header/footer时有效
 *
 *  @part  MMRefreshPartHeader/MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 *  @param list  动画数组
 *  @param state 状态
 */
- (void)setPart:(MMRefreshPart)part images:(NSArray *)list forState:(MMRefreshState)state;
/**
 *  创建标题
 *
 *  @part  MMRefreshPartHeader/MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 *  @param str   标题
 *  @param state 状态
 */
- (void)setPart:(MMRefreshPart)part headerTitle:(NSString *)str forState:(MMRefreshState)state;
/**
 *  开始刷新
 *  @part  MMRefreshPartHeader/MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 */
- (void)beginRefresh:(MMRefreshPart)part;
/**
 *  是否正在刷新
 *
 *  @part  MMRefreshPartHeader/MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 *  @return bool
 */
- (BOOL)isRefreshing:(MMRefreshPart)part;
/**
 *  结束刷新
 *  @part  MMRefreshPartHeader/MMRefreshPartAutoFooter/MMRefreshPartBackFooter
 */
- (void)endRefresh:(MMRefreshPart)part;
@end
